var config = {
  debug: true,
  columnTypes: {
    // 0: 'program',
    // 1: 'columnT',
    2: 'subject',
    3: 'activity',
    4: 'game'
  },
  typeids: [
    '1405788115477467137', // bgs
    '1413408910471073793', // main
    '1405443777035767809', // marquee
    '1405456919912517633', // recommend
    '1405457039802503170', // classify
    '1405457253191913474', // more
  ],
  // typeids: {
  //   '1405443777035767809': 'marquee',
  //   '1405456919912517633': 'recommend',
  //   '1405457039802503170': 'classify',
  //   '1405457253191913474': 'more',
  //   '1405788115477467137': 'bgs',
  //   main: '1413408910471073793',
  //   settings: '1405468369041231873',
  //   marquee: ["1405443777035767809"],
  //   video: ["1405444019592368130"],
  //   recommend: ["1405456919912517633"],
  //   classify: ["1405457039802503170", "1405457253191913474"],
  //   bgs: ["1405469008039251970", '1410110943601364993', '1412588722012033025', '1412679552798298113', '1413037771668328449'],  // logo, 首页背景, 公用图片, 询问框, 明星视频框
  // },
  // reg: /127.0.0.1|localhost/,
  mediaCode: '7efe10286f884c03b912be49a527fe75', // 熊猫博士看世界
  api: '', // 公网
  path: '/',
  init: function () {
    this._setStd()
    this._setPath()
    this._setApi()
    this._setPlatform()
  },
  _setStd: function () {
    try {
        this.userid = Authentication.CUGetConfig('UserID')
        this.ip = Authentication.CUGetConfig('IP')
        this.mac = Authentication.CUGetConfig('MAC')
    } catch (err) {
      this.userid = this.ip = this.mac = location.hostname
    }
  },
  isLocal: function () {
    var reg = /127.0.0.1|localhost/
    // this.isLocal = 
    return reg.test(location.host)
  },
  _setPlatform: function () {
    try {
      this.platform = location.host
    } catch (error) {
      console.log('获取platform错误')
    }
  },
  _setPath: function () {
    try {
      var href = location.href
      var questionIndex = href.indexOf('?')
      var path = questionIndex > -1 ? href.substring(0, questionIndex) : href
      this.path = path.substring(0, path.lastIndexOf('/'))
    } catch (error) {
      console.log('获取path错误')
    }
  },
  _setApi: function () {
    try {
      if(this.isLocal()){
        this.api = 'http://epg.mms.cloudgather.net:8000/';
      }else if(this.getOperators() == 'yd'){
        this.api = 'http://' + location.hostname + ':12208';
      }
      //this.api = this.isLocal() ? 'http://epg.mms.cloudgather.net:8000/' : 'http://' + location.host + '/'
    } catch (error) {
      console.log('获取api错误')
    }
  },
  // 获取平台 （华为、中兴）
  getPlatform: function () {
    var str = 'zx'
    if (page.urls.home.indexOf('Category') > -1) {
      str = 'hw'
    }
    return str
  },
  // 获取运营商 （移动、联通、电信）
  getOperators: function () {
    var str = 'yd'
    var href = location.href
    if (href.indexOf('192.168.5.5') > -1) {
      str = 'dx'
    } else if (href.indexOf('10.7.198.101') > -1) {
      str = 'lt'
    }
    return str
  },
  activity: {
    zx: 14,
    aesKey: '7A1396D5BC9A910E17F49DF2F756B570',
    appkey: '050ec6cc582c08f4ab8b2f873fdc818a',
    activityCode: 'pandashop'
  }
};

config.init()